6.4 Mapping attributes

Once you have configured your external identity provider, you must configure MyID to process the attributes returned in the claims, and map them to MyID attributes.

6.4.1 Finding a list of available claims

To determine which claims are returned from your external identity provider, you can enable logging for the web.oauth2 service.

See the MyID REST and authentication web services section in the Configuring Logging guide for details of enabling logging. Set the log level to INFO.

Once you have edited the Log.config file, add the following minimal Mappings section to the entry for your external identity provider in the ExternalProviders array of the appsettings.Production.json file for the web.oauth2 service:

Copy
"Mappings":[
  {
    "Match":{
    },
    "Attributes":[
      {
        "From":"givenName",
        "To":"FirstName"
      },
      {
        "From":"surname",
        "To":"Surname"
      },
      {
        "From":"",
        "To":"Roles",
        "Static":"<role name='Cardholder' scope='1'/>"
      },
      {
        "From":"",
        "To":"GroupName",
        "Static":"Imported From External IDP"
      },
      {
        "From":"",
        "To":"ParentGroupName",
        "Static":"External"
      }
    ]
  }
]

This set of mappings provides a minimal set of data to allow the web.oauth2 service to attempt to carry out a logon using the external identity provider; it does not allow you to log on, but allows MyID to retrieve the claims information from the external identity provider.

Save the file, then recycle the application pool in IIS to ensure that the web service is using the latest settings.

  1. On the MyID web server, in Internet Information Services (IIS) Manager, select Application Pools.
  2. Right-click the myid.web.oauth2.pool application pool, then from the pop-up menu click Recycle.

You can now attempt to log on to MyID using the external identity provider. The attempt fails with error OA10077, but the log displays a list of the claims returned from the identity provider that you can use to set up your mappings.

For example:

Copy
<LogEntry Type="InfoMessage">
  <TimeStamp>2024-02-22 14:42:15.560</TimeStamp>
  <ManagedThreadID>5</ManagedThreadID>
  <Class>Intercede.MyID.Logging.Log4Net.Log4NetLogger</Class>
  <Method>Microsoft.Extensions.Logging.ILogger.Log</Method>
  <Message>List of all claims available from provider: @odata.context: https://graph.microsoft.com/v1.0/$metadata#users/$entity,
  businessPhones: ["259"],
  displayName: Susan Smith,
  givenName: Susan,
  jobTitle: Business Analyst,
  mail: [email protected],
  mobilePhone: ,
  officeLocation: Headquarters,
  preferredLanguage: ,
  surname: Smith,
  userPrincipalName: [email protected],
  id: b0e777c5-02ff-4669-9c99-18780b334bd7</Message>
</LogEntry>

6.4.2 Matching attributes

You can use the Match option to restrict the users who can authenticate using the external identity provider by specifying a value for one of the claims returned.

For example, you may want to allow access only to people where the officeLocation claim is set to Headquarters:

Copy
"Match": {
  "officeLocation": "Headquarters"
},

6.4.3 Mapping attributes

You can include multiple items in the Attributes array. Each item can have the following properties: